import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import VueSetupExtend from 'vite-plugin-vue-setup-extend'
// import { lastCommitPlugin } from './src/plugin/last-commit-msg/index.js'
// import Inspect from 'vite-plugin-inspect'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(), 
    VueSetupExtend(), 
    // lastCommitPlugin(), 
    // Inspect({
    //   build: true,
    //   outputDir: '.vite-inspect'
    // })
  ],
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src'), // 设置 `@` 指向 `src` 目录
    }
  },
  server: {
    open: true,
    host: '0.0.0.0', // 设置本地Network
    port: 5173,
    proxy: {
      "/api": {
        target: 'http://127.0.0.1:3007', // 本地服务器
        changeOrigin: true,
        secure: false,
      },
    },
  },
  css: {
    preprocessorOptions: {
      // scss: {
        // additionalData: `@import "@/assets/css/global.scss";`
      // }
    }
  }
})
